home *** CD-ROM | disk | FTP | other *** search
- -- background: 2563 from stack: in
- -- bmap block id: 4467
- -- flags: 4000
- -- background id: 0
- -- name: Division
- ----- HyperTalk script -----
- function NumberOfTeams
- if "National" is in field "Division" then
- put 6 into X
- else
- put 7 into X
- end if
- return X
- end NumberOfTeams
-
- function PutWinsAndLosses Wins, Losses, WhichLine
- if Losses = 0 then
- put 1.000 into Percent
- else if Wins = 0 then
- put .000 into Percent
- else put "." & round((Wins/(Wins+Losses))*1000) into Percent
- put Wins into line WhichLine of field "Wins"
- put Losses into line WhichLine of field "Losses"
- put 162-Wins-Losses into line WhichLine of field "Games Left"
- put Percent into line WhichLine of field "Percent"
- get 0.5+(Percent-.5)*((Wins+Losses)/162)
- put true into Shifted
- repeat while Shifted
- if WhichLine>1 and Percent>line (WhichLine-1) of field "Percent" then
- get SwapLines(WhichLine,WhichLine-1)
- subtract 1 from WhichLine
- else if WhichLine<NumberOfTeams() and Percent<line (WhichLine+1) of field "Percent" then
- get SwapLines(WhichLine,WhichLine+1)
- add 1 to WhichLine
- else
- put False into Shifted
- end if
- end repeat
- return WhichLine
- end PutWinsAndLosses
-
- function SwapLines FirstLine, SecondLine
- put "Teams,Wins,Losses,Percent,Games Behind" into AllFields
- put ",Games Behind - Half,Games Left,Magic Number" after AllFields
- repeat with x = 1 to the number of items in AllFields
- put item x of AllFields into WhichField
- put line FirstLine of field WhichField into FirstStuff
- put line SecondLine of field WhichField into SecondStuff
- put FirstStuff into line SecondLine of field WhichField
- put SecondStuff into line FirstLine of field WhichField
- end repeat
- end SwapLines
-
- function IncrementWins WhichLine
- put line WhichLine of field "Wins" into Wins
- put line WhichLine of field "Losses" into Losses
- add 1 to Wins
- put PutWinsAndLosses(Wins,Losses,WhichLine) into WhichLine
- if line WhichLine of field "Games Behind" contains "-" then
- repeat with x = 1 to NumberOfTeams()
- if x is not WhichLine
- then get IncrementGamesBehind(x)
- end repeat
- else get DecrementGamesBehind(WhichLine)
- if WhichLine is 1
- then repeat with x = 1 to NumberOfTeams()
- if x is not WhichLine
- then subtract 1 from line x of field "Magic Number"
- end repeat
- end IncrementWins
-
- function IncrementLosses WhichLine
- put line WhichLine of field "Wins" into Wins
- put line WhichLine of field "Losses" into Losses
- add 1 to Losses
- put PutWinsAndLosses(Wins,Losses,WhichLine) into WhichLine
- put false into NewLeader
- if line WhichLine of field "Games Behind" contains "-" then
- repeat with x = 1 to NumberOfTeams()
- if x is not WhichLine then
- if DecrementGamesBehind(x) < 0 then put true into NewLeader
- end if
- end repeat
- if NewLeader then
- choose browse tool
- click at location of field "Games Behind"
- end if
- else get IncrementGamesBehind(WhichLine)
- if WhichLine is 1 then
- get empty
- else subtract 1 from line WhichLine of field "Magic Number"
- end IncrementLosses
-
- function GetGamesBehind WhichLine
- put line WhichLine of field "Games Behind" into GamesBehind
- if GamesBehind contains "-" then
- put 0.0 into GamesBehind
- end if
- if (line WhichLine of field "Games Behind - Half") is empty then
- add 0.0 to GamesBehind
- else add 0.5 to GamesBehind
- return GamesBehind
- end GetGamesBehind
-
- function PutGamesBehind GamesBehind, WhichLine
- if GamesBehind = 0 then
- put "--" into FormattedGamesBehind
- else if GamesBehind = 0.5 then
- put empty into FormattedGamesBehind
- else put round(GamesBehind - .25) into FormattedGamesBehind
- if GamesBehind = round(GamesBehind) then
- put empty into FormattedHalfGamesBehind
- else put "1/2" into FormattedHalfGamesBehind
- put FormattedGamesBehind into line WhichLine of field "Games Behind"
- put FormattedHalfGamesBehind into line WhichLine of field "Games Behind - Half"
- return GamesBehind
- end PutGamesBehind
-
- function IncrementGamesBehind WhichLine
- get GetGamesBehind(WhichLine)
- get PutGamesBehind(it+0.5,WhichLine)
- return it+0.5
- end IncrementGamesBehind
-
- function DecrementGamesBehind WhichLine
- get GetGamesBehind(WhichLine)
- get PutGamesBehind(it-0.5,WhichLine)
- return it-0.5
- end DecrementGamesBehind
-
-
-
-
- -- part 1 (field)
- -- low flags: 01
- -- high flags: 4000
- -- rect: left=14 top=88 right=201 bottom=92
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Teams
- ----- HyperTalk script -----
- on mouseUp
- put LineOfMouseClick("Teams") into WhichLine
- set the cursor to 4
- get line WhichLine of field "Teams"
- go to card it
- end mouseUp
-
-
-
- -- part 2 (field)
- -- low flags: 01
- -- high flags: 4000
- -- rect: left=105 top=88 right=201 bottom=140
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 65535
- -- font id: 3
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Wins
- ----- HyperTalk script -----
- on mouseUp
- get (item 2 of rect of field "Teams")
- put (the mouseV - it) into it
- put 1 + (it div (textHeight of field "Teams")) into WhichLine
- set the cursor to 4
- get IncrementWins(WhichLine)
- end mouseUp
-
-
-
- -- part 3 (field)
- -- low flags: 01
- -- high flags: 4000
- -- rect: left=147 top=88 right=201 bottom=182
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 65535
- -- font id: 3
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Losses
- ----- HyperTalk script -----
- on mouseUp
- get (item 2 of rect of field "Teams")
- put (the mouseV - it) into it
- put 1 + (it div (textHeight of field "Teams")) into WhichLine
- set the cursor to 4
- get IncrementLosses(WhichLine)
- end mouseUp
-
-
-
- -- part 4 (field)
- -- low flags: 01
- -- high flags: 4000
- -- rect: left=273 top=88 right=201 bottom=300
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 65535
- -- font id: 3
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Games Behind
- ----- HyperTalk script -----
- on mouseUp
- set the cursor to 4
- repeat with WhichLine = 1 to NumberOfTeams()
- put line WhichLine of field "Wins" into Wins
- put line WhichLine of field "Losses" into Losses
- put Wins-Losses into item WhichLine of AllDifferences
- end repeat
- put max(AllDifferences) into MaxWinLossDifference
- repeat with WhichLine = 1 to NumberOfTeams()
- put item WhichLine of AllDifferences into WinLossDifference
- put MaxWinLossDifference - WinLossDifference into WinLossBehind
- put WinLossBehind/2 into GamesBehind
- get PutGamesBehind(GamesBehind,WhichLine)
- end repeat
- end mouseUp
-
-
-
- -- part 5 (field)
- -- low flags: 01
- -- high flags: 4000
- -- rect: left=417 top=88 right=201 bottom=457
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 65535
- -- font id: 3
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Magic Number
- ----- HyperTalk script -----
- on mouseUp
- set the cursor to 4
- repeat with WhichLine = 1 to NumberOfTeams()
- put line WhichLine of field "Games Left" into GamesLeft
- put GamesLeft into item WhichLine of AllGamesLeft
- put line WhichLine of field "Wins" into Wins
- put line WhichLine of field "Losses" into Losses
- put Wins-Losses into item WhichLine of AllDifferences
- if char 1 of line WhichLine of field "Games Behind" is "-" then
- put item WhichLine of AllDifferences into ThisDifference
- put item WhichLine of AllGamesLeft into ThisGamesLeft
- end if
- end repeat
- repeat with WhichLine = 1 to NumberOfTeams()
- put item WhichLine of AllDifferences into WinLossDifference
- put item WhichLine of AllGamesLeft into GamesLeft
- get ThisGamesLeft+GamesLeft+WinLossDifference-ThisDifference
- put (it/2)+1 into MagicNumber
- if char 1 of line WhichLine of field "Games Behind" is "-"
- then put "--" into MagicNumber
- put MagicNumber into line WhichLine of field "Magic Number"
- end repeat
- end mouseUp
-
-
-
- -- part 6 (field)
- -- low flags: 01
- -- high flags: 4000
- -- rect: left=200 top=88 right=201 bottom=250
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 65535
- -- font id: 3
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Percent
- ----- HyperTalk script -----
- on mouseUp
- set the cursor to 4
- repeat with FirstLine = 1 to 6
- put line FirstLine of field "Percent" into FirstPercent
- repeat with SecondLine = FirstLine+1 to 7
- put line SecondLine of field "Percent" into SecondPercent
- if FirstPercent < SecondPercent then
- get SwapLines(FirstLine,SecondLine)
- put SecondPercent into FirstPercent
- end if
- end repeat
- end repeat
- end mouseUp
-
-
-
- -- part 8 (field)
- -- low flags: 01
- -- high flags: 4000
- -- rect: left=345 top=88 right=201 bottom=384
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 65535
- -- font id: 3
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Games Left
-
-
- -- part 9 (field)
- -- low flags: 01
- -- high flags: 0000
- -- rect: left=305 top=307 right=324 bottom=464
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Date
-
-
- -- part 10 (field)
- -- low flags: 01
- -- high flags: 4000
- -- rect: left=299 top=88 right=201 bottom=330
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 9
- -- style flags: 256
- -- line height: 16
- -- part name: Games Behind - Half
-
-
- -- part 23 (field)
- -- low flags: 01
- -- high flags: 0000
- -- rect: left=12 top=32 right=58 bottom=271
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 18
- -- style flags: 768
- -- line height: 24
- -- part name: Division
-
-
- -- part 26 (button)
- -- low flags: 00
- -- high flags: 8003
- -- rect: left=12 top=278 right=297 bottom=149
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Change Team Cards
- ----- HyperTalk script -----
- on mouseUp
- set the cursor to 4
- repeat with WhichLine = 1 to NumberOfTeams()
- put line WhichLine of field "Teams" into WhichTeam
- put "Teams,Wins,Losses,Percent,Games Behind,Games Behind - Half" into FieldsToCopy
- put ",Games Left" after FieldsToCopy
- put the number of this card into WhichDivisionCard
- push this card
- go to card WhichTeam
- put field "Date" of card WhichDivisionCard into field "Date"
- if field "Date" is not field "Clinch Date" then
- put empty into field "Clinch Date"
- end if
- repeat with x = 1 to the number of items in FieldsToCopy
- put item x of FieldsToCopy into WhichField
- get field WhichField of card WhichDivisionCard
- put it into field WhichField
- get line WhichLine of field WhichField
- put empty into line WhichLine of field WhichField
- put empty into field (WhichField & " Bold")
- put it into line WhichLine of field (WhichField & " Bold")
- end repeat
- click at location of field "Magic Number"
- pop card
- end repeat
- choose browse tool
- end mouseUp
-
-
-
- -- part 28 (field)
- -- low flags: 01
- -- high flags: 0000
- -- rect: left=91 top=88 right=201 bottom=106
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Teams
- ----- HyperTalk script -----
- on mouseUp
- put LineOfMouseClick("Teams") into WhichLine
- set the cursor to 4
- put line WhichLine of field "Teams" into WhichTeam
- put line WhichLine of field "Wins" into Wins
- put line WhichLine of field "Losses" into Losses
- ask WhichTeam && "Won-Loss Record" with Wins & "," & Losses
- if it is not empty then
- put item 1 of it into Wins
- put item 2 of it into Losses
- put PutWinsAndLosses(Wins,Losses,WhichLine) into WhichLine
- choose browse tool
- click at location of field "Games Behind"
- click at location of field "Magic Number"
- end if
- end mouseUp
-
-
-
- -- part 29 (button)
- -- low flags: 00
- -- high flags: 8003
- -- rect: left=11 top=311 right=328 bottom=58
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 1
- -- font id: 21
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Browse
- ----- HyperTalk script -----
- on mouseUp
- go to card "Index"
- end mouseUp
-
-
-
-
- -- part 32 (button)
- -- low flags: 00
- -- high flags: 8003
- -- rect: left=62 top=311 right=328 bottom=109
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 1
- -- font id: 21
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Help
- ----- HyperTalk script -----
- on mouseUp
- go to card "Help"
- end mouseUp
-
-
-
-
- -- part 33 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=117 top=307 right=330 bottom=139
- -- title width / last selected line: 0
- -- icon id / first selected line: 15420 / 15420
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: GoToPrev
- ----- HyperTalk script -----
- on mouseUp
- go to previous card
- end mouseUp
-
-
-
- -- part 34 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=144 top=306 right=331 bottom=168
- -- title width / last selected line: 0
- -- icon id / first selected line: 16560 / 16560
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: GoToPrev
- ----- HyperTalk script -----
- on mouseUp
- go to next card
- end mouseUp
-
-